package com.iqiyi.pps.epg.core.dao.vod;

import com.iqiyi.pps.epg.api.model.web.vod.TVodRecord;
import com.iqiyi.pps.epg.core.dao.base.BaseDao;
import com.iqiyi.pps.epg.core.model.vod.VodRecord;
import com.iqiyi.pps.epg.core.utils.DateTimeUtil;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

@Component
public class VodRecordDao extends BaseDao<VodRecord> {
    public TVodRecord transToThrift(VodRecord tempData) {
        TVodRecord tVodRecord = new TVodRecord();
        tVodRecord.setId(tempData.getId());
        tVodRecord.setStartTime(tempData.getStartTime());
        tVodRecord.setEndTime(tempData.getEndTime());
        tVodRecord.setChannelId(tempData.getChannelId());
        tVodRecord.setOpUser(tempData.getOpUser());
        tVodRecord.setProjectWorkers(tempData.getProjectWorkers());
        tVodRecord.setNotifyType(tempData.getNotifyType());
        tVodRecord.setAddTime(DateTimeUtil.transLongFormat(tempData.getAddTime().getTime()));
        tVodRecord.setStatus(tempData.getStatus() );
        tVodRecord.setUpdateTime( DateTimeUtil.transLongFormat(tempData.getUpdateTime().getTime()));
        return tVodRecord;
    }

    public List<TVodRecord> transToTList(List<VodRecord> dataList) {
        List<TVodRecord> resultList = new ArrayList<>();
        TVodRecord tVodRecord = null;
        for (VodRecord tempData : dataList) {
            tVodRecord = transToThrift(tempData);
            resultList.add(tVodRecord);
        }
        return resultList;
    }
}
